home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 July & August / PCWorld_2006-07-08_cd.bin / komunikace / apache / apache_2[1].2.2-win32-x86-no_ssl.msi / Data1.cab / _44BF9383223D182A20F9060A359E86D4 < prev    next >
Extensible Markup Language  |  2006-01-15  |  14KB  |  316 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
  4.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  5.               This file is generated from xml source: DO NOT EDIT
  6.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  7.       -->
  8. <title>mod_proxy_balancer - Apache HTTP Server</title>
  9. <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
  10. <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
  11. <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
  12. <link href="../images/favicon.ico" rel="shortcut icon" /></head>
  13. <body>
  14. <div id="page-header">
  15. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
  16. <p class="apache">Apache HTTP Server Version 2.2</p>
  17. <img alt="" src="../images/feather.gif" /></div>
  18. <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
  19. <div id="path">
  20. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
  21. <div id="page-content">
  22. <div id="preamble"><h1>Apache Module mod_proxy_balancer</h1>
  23. <div class="toplang">
  24. <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English"> en </a> |
  25. <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
  26. </div>
  27. <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> extension for load balancing </td></tr>
  28. <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
  29. <tr><th><a href="module-dict.html#ModuleIdentifier">ModuleáIdentifier:</a></th><td>proxy_balancer_module</td></tr>
  30. <tr><th><a href="module-dict.html#SourceFile">SourceáFile:</a></th><td>proxy_balancer.c</td></tr>
  31. <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.1 and later</td></tr></table>
  32. <h3>Summary</h3>
  33.  
  34.     <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. It provides load balancing support for
  35.     <code>HTTP</code>, <code>FTP</code> and <code>AJP13</code> protocols
  36.     </p>
  37.  
  38.     <p>Thus, in order to get the ability of load balancing,
  39.     <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
  40.     have to be present in the server.</p>
  41.  
  42.     <div class="warning"><h3>Warning</h3>
  43.       <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
  44.       servers are dangerous both to your network and to the Internet at
  45.       large.</p>
  46.     </div>
  47. </div>
  48. <div id="quickview"><h3 class="directives">Directives</h3>
  49. <p>This module provides no
  50.             directives.</p>
  51. <h3>Topics</h3>
  52. <ul id="topics">
  53. <li><img alt="" src="../images/down.gif" /> <a href="#scheduler">Load balancer scheduler algorithm</a></li>
  54. <li><img alt="" src="../images/down.gif" /> <a href="#requests">Request Counting Algorithm</a></li>
  55. <li><img alt="" src="../images/down.gif" /> <a href="#traffic">Weighted Traffic Counting Algorithm</a></li>
  56. <li><img alt="" src="../images/down.gif" /> <a href="#enable">Enabling Balancer Manager Support</a></li>
  57. </ul><h3>See also</h3>
  58. <ul class="seealso">
  59. <li><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></li>
  60. </ul></div>
  61. <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  62. <div class="section">
  63. <h2><a name="scheduler" id="scheduler">Load balancer scheduler algorithm</a></h2>
  64.     
  65.     <p>At present, there are 2 load balancer scheduler algorithms available
  66.     for use: Request Counting and Weighted Traffic Counting. These are controlled
  67.     via the <code>lbmethod</code> value of the Balancer definition. See
  68.     the <code class="directive"><a href="../mod/mod_proxy.html#proxy">Proxy</a></code> directive for
  69.     more information.</p>
  70.  
  71. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  72. <div class="section">
  73. <h2><a name="requests" id="requests">Request Counting Algorithm</a></h2>
  74.     
  75.     <p>Enabled via <code>lbmethod=byrequests</code>, the idea behind this
  76.     scheduler is that we distribute the requests among the
  77.     various workers to ensure that each gets their configured share
  78.     of the number of requests. It works as follows:</p>
  79.  
  80.     <p><dfn>lbfactor</dfn> is <em>how much we expect this worker
  81.     to work</em>, or <em>the workers's work quota</em>. This is
  82.     a normalized value representing their "share" of the amount of
  83.     work to be done.</p>
  84.  
  85.     <p><dfn>lbstatus</dfn> is <em>how urgent this worker has to work
  86.     to fulfill its quota of work</em>.</p>
  87.  
  88.     <p>The <dfn>worker</dfn> is a member of the load balancer,
  89.     usually a remote host serving one of the supported protocols.</p>
  90.  
  91.     <p>We distribute each worker's work quota to the worker, and then look
  92.     which of them needs to work most urgently (biggest lbstatus).  This
  93.     worker is then selected for work, and its lbstatus reduced by the
  94.     total work quota we distributed to all workers.  Thus the sum of all
  95.     lbstatus does not change(*) and we distribute the requests
  96.     as desired.</p>
  97.  
  98.     <p>If some workers are disabled, the others will
  99.     still be scheduled correctly.</p>
  100.  
  101.     <div class="example"><pre><code>for each worker in workers
  102.     worker lbstatus += worker lbfactor
  103.     total factor    += worker lbfactor
  104.     if worker lbstatus > candidate lbstatus
  105.         candidate = worker
  106.  
  107. candidate lbstatus -= total factor</code></pre></div>
  108.  
  109.     <p>If a balancer is configured as follows:</p>
  110.     
  111.     <table><tr><th>worker</th>
  112.         <th class="data">a</th>
  113.         <th class="data">b</th>
  114.         <th class="data">c</th>
  115.         <th class="data">d</th></tr>
  116. <tr><th>lbfactor</th>
  117.         <td class="data">25</td>
  118.         <td class="data">25</td>
  119.         <td class="data">25</td>
  120.         <td class="data">25</td></tr>
  121. <tr><th>lbstatus</th>
  122.         <td class="data">0</td>
  123.         <td class="data">0</td>
  124.         <td class="data">0</td>
  125.         <td class="data">0</td></tr>
  126. </table>
  127.  
  128.     <p>And <var>b</var> gets disabled, the following schedule is produced:</p>
  129.  
  130.     <table><tr><th>worker</th>
  131.         <th class="data">a</th>
  132.         <th class="data">b</th>
  133.         <th class="data">c</th>
  134.         <th class="data">d</th></tr>
  135. <tr><th>lbstatus</th>
  136.         <td class="data"><em>-50</em></td>
  137.         <td class="data">0</td>
  138.         <td class="data">25</td>
  139.         <td class="data">25</td></tr>
  140. <tr><th>lbstatus</th>
  141.         <td class="data">-25</td>
  142.         <td class="data">0</td>
  143.         <td class="data"><em>-25</em></td>
  144.         <td class="data">50</td></tr>
  145. <tr><th>lbstatus</th>
  146.         <td class="data">0</td>
  147.         <td class="data">0</td>
  148.         <td class="data">0</td>
  149.         <td class="data"><em>0</em></td></tr>
  150. <tr><td class="data" colspan="5">(repeat)</td></tr>
  151. </table>
  152.  
  153.     <p>That is it schedules: <var>a</var> <var>c</var> <var>d</var>
  154.     <var>a</var> <var>c</var> <var>d</var> <var>a</var> <var>c</var>
  155.     <var>d</var> ... Please note that:</p>
  156.  
  157.     <table><tr><th>worker</th>
  158.         <th class="data">a</th>
  159.         <th class="data">b</th>
  160.         <th class="data">c</th>
  161.         <th class="data">d</th></tr>
  162. <tr><th>lbfactor</th>
  163.         <td class="data">25</td>
  164.         <td class="data">25</td>
  165.         <td class="data">25</td>
  166.         <td class="data">25</td></tr>
  167. </table>
  168.  
  169.     <p>Has the exact same behavior as:</p>
  170.  
  171.     <table><tr><th>worker</th>
  172.         <th class="data">a</th>
  173.         <th class="data">b</th>
  174.         <th class="data">c</th>
  175.         <th class="data">d</th></tr>
  176. <tr><th>lbfactor</th>
  177.         <td class="data">1</td>
  178.         <td class="data">1</td>
  179.         <td class="data">1</td>
  180.         <td class="data">1</td></tr>
  181. </table>
  182.  
  183.     <p>This is because all values of <dfn>lbfactor</dfn> are normalized
  184.     with respect to the others. For:</p>
  185.  
  186.     <table><tr><th>worker</th>
  187.         <th class="data">a</th>
  188.         <th class="data">b</th>
  189.         <th class="data">c</th></tr>
  190. <tr><th>lbfactor</th>
  191.         <td class="data">1</td>
  192.         <td class="data">4</td>
  193.         <td class="data">1</td></tr>
  194. </table>
  195.  
  196.     <p>worker <var>b</var> will, on average, get 4 times the requests
  197.     that <var>a</var> and <var>c</var> will.</p>
  198.  
  199.     <p>The following asymmetric configuration works as one would expect:</p>
  200.  
  201.     <table><tr><th>worker</th>
  202.         <th class="data">a</th>
  203.         <th class="data">b</th></tr>
  204. <tr><th>lbfactor</th>
  205.         <td class="data">70</td>
  206.         <td class="data">30</td></tr>
  207. <tr><td class="data" colspan="2"> </td></tr>
  208. <tr><th>lbstatus</th>
  209.         <td class="data"><em>-30</em></td>
  210.         <td class="data">30</td></tr>
  211. <tr><th>lbstatus</th>
  212.         <td class="data">40</td>
  213.         <td class="data"><em>-40</em></td></tr>
  214. <tr><th>lbstatus</th>
  215.         <td class="data"><em>10</em></td>
  216.         <td class="data">-10</td></tr>
  217. <tr><th>lbstatus</th>
  218.         <td class="data"><em>-20</em></td>
  219.         <td class="data">20</td></tr>
  220. <tr><th>lbstatus</th>
  221.         <td class="data"><em>-50</em></td>
  222.         <td class="data">50</td></tr>
  223. <tr><th>lbstatus</th>
  224.         <td class="data">20</td>
  225.         <td class="data"><em>-20</em></td></tr>
  226. <tr><th>lbstatus</th>
  227.         <td class="data"><em>-10</em></td>
  228.         <td class="data">10</td></tr>
  229. <tr><th>lbstatus</th>
  230.         <td class="data"><em>-40</em></td>
  231.         <td class="data">40</td></tr>
  232. <tr><th>lbstatus</th>
  233.         <td class="data">30</td>
  234.         <td class="data"><em>-30</em></td></tr>
  235. <tr><th>lbstatus</th>
  236.         <td class="data"><em>0</em></td>
  237.         <td class="data">0</td></tr>
  238. <tr><td class="data" colspan="3">(repeat)</td></tr>
  239. </table>
  240.  
  241.     <p>That is after 10 schedules, the schedule repeats and 7 <var>a</var>
  242.     are selected with 3 <var>b</var> interspersed.</p>
  243. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  244. <div class="section">
  245. <h2><a name="traffic" id="traffic">Weighted Traffic Counting Algorithm</a></h2>
  246.     
  247.     <p>Enabled via <code>lbmethod=bytraffic</code>, the idea behind this
  248.     scheduler is very similar to the Request Counting method, with
  249.     the following changes:</p>
  250.  
  251.     <p><dfn>lbfactor</dfn> is <em>how much traffic, in bytes, we want
  252.     this worker to handle</em>. This is also a normalized value
  253.     representing their "share" of the amount of work to be done,
  254.     but instead of simply counting the number of requests, we take
  255.     into account the amount of traffic this worker has seen.</p>
  256.  
  257.     <p>If a balancer is configured as follows:</p>
  258.     
  259.     <table><tr><th>worker</th>
  260.         <th class="data">a</th>
  261.         <th class="data">b</th>
  262.         <th class="data">c</th></tr>
  263. <tr><th>lbfactor</th>
  264.         <td class="data">1</td>
  265.         <td class="data">2</td>
  266.         <td class="data">1</td></tr>
  267. </table>
  268.  
  269.     <p>Then we mean that we want <var>b</var> to process twice the
  270.     amount of bytes than <var>a</var> or <var>c</var> should. It does
  271.     not necessarily mean that <var>b</var> would handle twice as
  272.     many requests, but it would process twice the I/O. Thus, the
  273.     size of the request and response are applied to the weighting
  274.     and selection algorithm.</p>
  275.  
  276. </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
  277. <div class="section">
  278. <h2><a name="enable" id="enable">Enabling Balancer Manager Support</a></h2>
  279.     
  280.     <p>This module <em>requires</em> the service of 
  281.     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.
  282.     Balancer manager enables dynamic update of balancer
  283.     members. You can use balancer manager to change the balance
  284.     factor or a particular member, or put it in the off line
  285.     mode.
  286.     </p>
  287.  
  288.     <p>Thus, in order to get the ability of load balancer management,
  289.     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> and <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
  290.     have to be present in the server.</p>
  291.  
  292.     <p>To enable load balancer management for browsers from the foo.com
  293.     domain add this code to your <code>httpd.conf</code>
  294.     configuration file</p>
  295. <div class="example"><p><code>
  296.     <Location /balancer-manager><br />
  297.     SetHandler balancer-manager<br />
  298. <br />
  299.     Order Deny,Allow<br />
  300.     Deny from all<br />
  301.     Allow from .foo.com<br />
  302.     </Location>
  303. </code></p></div>
  304.  
  305.     <p>You can now access load balancer manager by using a Web browser
  306.     to access the page
  307.     <code>http://your.server.name/balancer-manager</code></p>
  308. </div>
  309. </div>
  310. <div class="bottomlang">
  311. <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English"> en </a> |
  312. <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
  313. </div><div id="footer">
  314. <p class="apache">Copyright 1995-2006 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
  315. <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
  316. </body></html>